<?php
	include_once('./global.php');
	session_start();
	
	$url = $_SERVER['REQUEST_URI'];
	$url_arr = parse_url($url);
	parse_str($url_arr['query'],$url_arr);
	$category_id = $url_arr[id];
	
	$sql = "select * from categoryinfo where C_CID = '$category_id'";
	$query = $mysqli->query($sql);
	$result = $query->fetch_assoc();
	
	if(isset($_POST['update_category'])){
		$sql_update = "update categoryinfo set C_Categoryname = '$_POST[category_title]' where C_CID = '$category_id'";
		$query_update = $mysqli->query($sql_update);
		if($query_update){
			echo "<script>alert('修改成功')</script>";
						
		}else{
			echo "<script>alert('修改失败')</script>";
		}
		echo "<meta http-equiv=\"refresh\" content=\"1; url='admin_category_mangerment.php' />";
		
	}
	

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台首页</title>
<style>
	body{ background:#e7e7e7; margin:0; padding:0;}
	#container{ width:980px; height:auto; position:relative; margin:0 auto;}
	#container #header{ width:980px; height:90px; position:relative; background:#000; line-height:90px;color:#fff; font-size:24px; text-align:center;}
	.left{width:250px; height:auto; position:relative; float:left;}
	.left table{width:248px; height:auto; position:relative; float:left; background:#fff;}
	.left table td{ height:20px; text-align:center;}
	.left table .selected{ background:#73abe3;}
	#content{ width:730px; height:100%; position:relative; float:left; margin:2px 0px;}
	#content .title{ width:720px; height:25px; position:relative; float:left; line-height:25px; font-size:18px; color:#fff; background:#000;}
	form{margin:20px auto; width:720px; height:auto; position:relative; float:left;}
	form .inpuarea{ width:360px; height:150px;}
</style>
</head>
<body>
	<div id="container">
		<div id="header">
			818苹果站后台管理
		</div>
		<div class="left">
			<table>
				<tr><td style="background:#000000; color:#fff;">站点管理</td></tr>
				<tr><td><a href="admin_site_mangerment.php">全局管理</a></td></tr>
				<tr><td>静态页面管理</td></tr>
				<tr><td><a href="admin_link_mangerment.php?page=1">友情链接管理</a></td></tr>
				<tr><td><a href="admin_member_mangerment.php?page=1">会员管理</a></td></tr>
				<tr><td><a href="admin_tags_mangerment.php">标签管理</a></td></tr>
				<tr><td><a href="admin_search_mangerment.php">搜索管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">文章管理</td></tr>
				<tr><td class="selected"><a href="admin_category_mangerment.php">文章分类管理</a></td></tr>
				<tr><td><a href="admin_news_add.php">发布文章</a></td></tr>
				<tr><td><a href="admin_news_mangerment.php">文章管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">应用管理</td></tr>
				<tr><td><a href="admin_appcate_mangerment.php">应用分类管理</a></td></tr>
				<tr><td><a href="admin_app_add.php">添加应用</a></td></tr>
				<tr><td><a href="admin_app_mangerment.php">应用管理</a></td></tr>
				<tr><td><a href="admin_app_collection.php">应用采集</a></td></tr>
				<tr><td><a href="admin_app_collection_single.php">单应用采集</a></td></tr>
			</table>
		</div>	<div id="content">
		<div class="title">文章分类管理</div>
		<form action="" method="post">
		<table>
			<tr>文章分类名称修改(注：分类名称不得超过10个字符)</tr>
			<tr>
				<td>分类编号</td>
				<td>分类名称</td>
			</tr>
			<tr>
            	<td>
                	<?php echo $result['C_CID']?>
                </td>
				<td>
					<input type="text" name="category_title" value="<?php echo $result['C_Categoryname']?>" />
				</td>
			</tr>
			<tr>
				<td>
					<input type="submit" name="update_category" value="修改" />
 				</td>
			</tr>
		</table>
		</form>
	</div>
    </div>
</body>
</html>